package com.simple.web.controller.business;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.zuihou.base.R;
import com.github.zuihou.base.request.PageParams;
import com.simple.business.domain.dto.evaluation.EvaluationDTO;
import com.simple.business.domain.dto.evaluation.EvaluationSaveDTO;
import com.simple.business.domain.vo.evaluation.EvaluationQuestionVO;
import com.simple.business.domain.vo.evaluation.EvaluationReportVO;
import com.simple.business.domain.vo.evaluation.EvaluationVO;
import com.simple.business.service.evaluation.EvaluationService;
import com.simple.business.service.evaluation.ToyService;
import com.simple.common.annotation.Anonymous;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @desc
 * @Author Simple
 * @Date 2025/3/10 21:59
 **/
@Slf4j
@RequestMapping("/toy")
@RestController
// @Anonymous
public class ToyController {

    @Resource
    private ToyService toyService;
    @Resource
    private EvaluationService evaluationService;

    @GetMapping("/createEvaluationQuestion")
    @ApiOperation("生成题目")
    public R<List<EvaluationQuestionVO>> createEvaluationQuestion(String evaluationType){
        return toyService.createEvaluationQuestion(evaluationType);
    }

    @PostMapping("/saveEvaluationReport")
    @ApiOperation("保存测评报告")
    public R<Boolean> saveEvaluationReport(@RequestBody EvaluationSaveDTO evaluationSaveDTO){
        return evaluationService.saveEvaluationReport(evaluationSaveDTO);
    }

    @ApiOperation(value = "查看测评列表")
    @PostMapping( "/queryEvaluations")
    public R<IPage<EvaluationVO>> queryEvaluations(@RequestBody PageParams<EvaluationDTO> params) {
        return evaluationService.queryEvaluations(params);
    }

    @ApiOperation(value = "根据id查看报告详情")
    @GetMapping( "/queryEvaluationReportById/{evaluationId}")
    public R<EvaluationReportVO> queryEvaluationReportById(@PathVariable("evaluationId") Long evaluationId) {
        return evaluationService.queryEvaluationReportById(evaluationId);
    }


    @ApiOperation(value = "删除测评报告")
    @DeleteMapping( "/deleteEvaluationReport/{evaluationId}")
    public R<Boolean> deleteAIJobInterviewReport(@PathVariable("evaluationId") Long evaluationId) {
        return evaluationService.deleteEvaluationReport(evaluationId);
    }





}
